package com.cw.jeeyt.service.converter.system;

import java.util.ArrayList;
import java.util.List;

import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.cw.jeeyt.service.bo.system.SystemAboutUsBo;
import com.cw.jeeyt.dao.model.system.SystemAboutUsDo;
import com.cw.lang.common.utils.CollectionUtil;

/**
 * 关于我们转换类
 *
 * @author chenw
 * @date 2019-03-10 13:04:25
 */
public class SystemAboutUsConverter {

    /**
     * do转bo
     *
     * @param model
     * @return
     */
    public static SystemAboutUsBo do2Bo(SystemAboutUsDo model) {
        if (model == null) {
            return null;
        }
        SystemAboutUsBo bo = new SystemAboutUsBo();
        bo.setId(model.getId());
        bo.setCorpInfo(model.getCorpInfo());
        bo.setCorpTeam(model.getCorpTeam());
        bo.setCorpHistory(model.getCorpHistory());
        bo.setCorpCulture(model.getCorpCulture());
        bo.setCorpPartners(model.getCorpPartners());
        bo.setCorpHonor(model.getCorpHonor());
        bo.setCorpRecruitment(model.getCorpRecruitment());
        bo.setCreateBy(model.getCreateBy());
        bo.setCreateDate(model.getCreateDate());
        bo.setUpdateBy(model.getUpdateBy());
        bo.setUpdateDate(model.getUpdateDate());
        return bo;
    }

    /**
     * bo转do
     *
     * @param bo
     * @return
     */
    public static SystemAboutUsDo bo2Do(SystemAboutUsBo bo) {
        if (bo == null) {
            return null;
        }
        SystemAboutUsDo model = new SystemAboutUsDo();
        model.setId(bo.getId());
        model.setCorpInfo(bo.getCorpInfo());
        model.setCorpTeam(bo.getCorpTeam());
        model.setCorpHistory(bo.getCorpHistory());
        model.setCorpCulture(bo.getCorpCulture());
        model.setCorpPartners(bo.getCorpPartners());
        model.setCorpHonor(bo.getCorpHonor());
        model.setCorpRecruitment(bo.getCorpRecruitment());
        model.setCreateBy(bo.getCreateBy());
        model.setCreateDate(bo.getCreateDate());
        model.setUpdateBy(bo.getUpdateBy());
        model.setUpdateDate(bo.getUpdateDate());
        return model;
    }

    /**
     * doList转boList
     *
     * @param doList
     * @return
     */
    public static List<SystemAboutUsBo> doList2BoList(List<SystemAboutUsDo> doList) {
        if (CollectionUtil.isEmpty(doList)) {
            return new ArrayList<>();
        }
        return Lists.newArrayList(Iterators.transform(doList.iterator(), SystemAboutUsConverter::do2Bo));
    }

    /**
     * boList转doList
     *
     * @param boList
     * @return
     */
    public static List<SystemAboutUsDo> boList2DoList(List<SystemAboutUsBo> boList) {
        if (CollectionUtil.isEmpty(boList)) {
            return new ArrayList<>();
        }
        return Lists.newArrayList(Iterators.transform(boList.iterator(), SystemAboutUsConverter::bo2Do));
    }
}